package com.txhy.certificatechain.ui.fragment.friend;

import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.txhy.certificatechain.R;
import com.txhy.certificatechain.model.bean.ReceiveListBean;
import com.txhy.certificatechain.presenter.base.BasePresenter;
import com.txhy.certificatechain.ui.activity.base.BaseFragment;
import com.txhy.certificatechain.ui.adapter.FriendsListAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/*
 * -----------------------------------------------------------------
 * Copyright (C) 2018-2030, by your company, All rights reserved.
 * -----------------------------------------------------------------
 * 文    件: FriendListFragment.java
 * 作    者: 侯建军
 * 版    权: 1.0.0
 * 描    述: 好友列表片段
 * 创建时间: 2018/9/20 9:46
 * 更新时间：2018/9/20 9:46
 * -----------------------------------------------------------------
 * 2018/9/20 9:46: 创建 FriendListFragment.java (侯建军);
 * -----------------------------------------------------------------
 */
public class FriendListFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener,
        BaseQuickAdapter.RequestLoadMoreListener {
    @BindView(R.id.swipe_refresh)
    SwipeRefreshLayout swipe_refresh;
    @BindView(R.id.rv_content)
    RecyclerView rv_content;
    private FriendsListAdapter mAdapter;

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    public static FriendListFragment newInstance() {
        return new FriendListFragment();
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.fragment_friend_list;
    }

    @Override
    public void initView(View rootView) {
        super.initView(rootView);
        rv_content.setLayoutManager(new LinearLayoutManager(getActivity()));

        List<ReceiveListBean.DataEntity.RDataEntity> list = new ArrayList<>();
        list.add(new ReceiveListBean.DataEntity.RDataEntity());
        list.add(new ReceiveListBean.DataEntity.RDataEntity());
        list.add(new ReceiveListBean.DataEntity.RDataEntity());
        list.add(new ReceiveListBean.DataEntity.RDataEntity());
        list.add(new ReceiveListBean.DataEntity.RDataEntity());

        mAdapter = new FriendsListAdapter(getActivity(), list);
        rv_content.setAdapter(mAdapter);
        swipe_refresh.setOnRefreshListener(this);
        View view=View.inflate(getActivity(),R.layout.item_friends_list,null);
        TextView tv_name=view.findViewById(R.id.tv_name);
        TextView tv_msg=view.findViewById(R.id.tv_msg);
        ImageView img_msg=view.findViewById(R.id.img_msg);
        img_msg.setImageResource(R.mipmap.lingling);

        tv_name.setText("好友提醒");
        tv_msg.setText("您有新的好友通知");

        mAdapter.addHeaderView(view);
    }

    @Override
    public void onRefresh() {

    }

    @Override
    public void onLoadMoreRequested() {

    }

//    @OnClick({R.id.img_erCode,R.id.ll_long,R.id.tv_one,R.id.tv_two,R.id.tv_three})
//    public void onViewClicked(View view) {
//        switch (view.getId()) {
//            case R.id.img_erCode:
//                DiaLogUtils.showErCodeDialog(getActivity());
//                break;
//            case R.id.ll_long:
//                ll_long.setVisibility(View.GONE);
//                break;
//            case R.id.tv_one:
//                ll_long.setVisibility(View.GONE);
//                break;
//            case R.id.tv_two:
//                ll_long.setVisibility(View.GONE);
//                break;
//            case R.id.tv_three:
//                ll_long.setVisibility(View.GONE);
//                break;
//        }
//    }
}
